import React from "react";
import ReactDom from "react-dom";
import { BrowserRouter} from "react-router-dom";
import { Provider } from 'react-redux'; // 负责把store提供给子组件
import {ConfigProvider} from 'antd';
import zhCN from 'antd/es/locale/zh_CN';
import { PersistGate } from "redux-persist/integration/react";

import "./assets/css/common.less";

import history from './store/history';
import { store, persistor }  from './store'
import Routes from "./routes";
import Tabs from "./components/Tabs";
import { ConnectedRouter } from "connected-react-router";
import config from "./utils/config"

const App = () => (
  <Provider store={store}>
    <PersistGate loading={null} persistor={persistor}>
    <ConnectedRouter history={history}>
      <ConfigProvider locale={zhCN}>
        <Routes />
        <Tabs />
      </ConfigProvider>
    </ConnectedRouter>
    </PersistGate>
  </Provider>
);

// 配置拿到后在渲染
config.loadConfig().finally(()=>{
  ReactDom.render(<App />, document.getElementById("app"));
});


